﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace Acme.BookStore.Storage
{
    public class LogService : ApplicationService, ILogService
    {
        private readonly IRepository<InboundOperationLog, Guid> _logRepository;

        public LogService(IRepository<InboundOperationLog, Guid> logRepository)
        {
            _logRepository = logRepository;
        }

        public async Task LogAsync(string operatorName, string operationType, string description, Guid? inboundManageId = null)
        {
            var log = new InboundOperationLog
            {
                OperatorName = operatorName,
                OperationType = operationType,
                Description = description,
                InboundManageId = inboundManageId
            };

            await _logRepository.InsertAsync(log);
        }
    }
}
